<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./js/jquery-3.6.0.js"></script>
  </head>
  <body>
    <form action="" id="regFrm">
      <input type="text" name="username" placeholder="请输入用户名" /> <br />
      <input type="password" name="pswd" placeholder="请输入密码" /> <br />
      <input type="text" name="email" placeholder="请输入邮箱" /> <br />
      <button type="button">注册</button>
    </form>
  </body>
</html>
<script>
  //1.传统的方式 获得用户输入值 向服务器端发送数据
  // http://127.0.0.1:5500/day07/reg.jsp?username=aaa&pswd=111&email=xx@126.com
  // $('button').click(function () {
  //   var username = $("[name='username']").val()
  //   var pswd = $("[name='pswd']").val()
  //   var email = $("[name='email']").val()
  //   var param = 'username=' + username + '&pswd=' + pswd + '&email=' + email
  //   location.href = 'reg.jsp?' + param
  // })

  // http://127.0.0.1:5500/day07/reg.jsp?username=aaa&pswd=1%6011&email=xx%40126.com
  $('button').click(function () {
    location.href = 'reg.jsp?' + $('#regFrm').serialize()
  })
</script>
